import { Agent } from "../src/processPool";

let i = 0;
let j = 0;
export default class Test extends Agent {
  public async run() {
    setInterval(() => {
      console.log('agent...........');
    }, 3000);
  }

  public receiveMessage(data) {
    i ++;
    console.log('agent', 'receive', data);
    if (i >= 5) {
      i = 0;
      this.sendToWorker('全部收到了！');
      throw new Error('AGENT ERROR');
    }
  }
}